package com.zhentao.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhentao.common.dtos.ResponseResult;
import com.zhentao.coupons.domain.UserCoupons;
import com.zhentao.date.DateUtils;
import com.zhentao.service.UserCouponsService;
import com.zhentao.mapper.UserCouponsMapper;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
* @author 86188
* @description 针对表【user_coupons】的数据库操作Service实现
* @createDate 2024-09-05 14:06:30
*/
@Service
public class UserCouponsServiceImpl extends ServiceImpl<UserCouponsMapper, UserCoupons>
    implements UserCouponsService{


    @Override
    public ResponseResult addCoupons(Integer userId) {
        UserCoupons userCoupons = new UserCoupons();
        userCoupons.setUserId(userId);
        userCoupons.setCouponsId(1);
        userCoupons.setCreateTime(new Date());
        userCoupons.setStatus(1);
        Date date = DateUtils.nextMonth(1);
        userCoupons.setExpirationTime(date);
        this.save(userCoupons);
        return ResponseResult.okResult("ok");
    }
}




